﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using FinalOnlineLibrary.Models;
using OnlineLibrary.ToLinq;
using FinalOnlineLibrary.DAL;


namespace FinalOnlineLibrary.Controllers
{
    public class NavigationController : Controller
    {
        //
        // GET: /Navigation/

        public ActionResult Index()
        {
            return View();
        }

        /// <summary>
        /// Display Resource Type into Master page 
        /// </summary>
        /// <returns></returns>
        public ActionResult Menu() 
        {
            //Session.Add("Admin", false);
            //Session.Add("Staff", false);
            //Session.Add("User", false);
            //Session.Add("Guest", true);

            var listMenu = DALBooks.GetAllResType().ToList();

            var viewModel = new NavigationModel 
            {
                ResTypeMenu = listMenu
            };
            return View(viewModel);
        }


        /// <summary>
        /// Display dropdownlist ResType and CategoryType into UResultSearchPage
        /// </summary>
        /// <returns></returns>
        public ActionResult UResultSearchPage()
        {
            ViewData["DDLResType"] = new SelectList(DALBooks.GetAllResType().ToList(), "ResTypeID", "ResTypeName");
            ViewData["DDLCatType"] = new SelectList(DALBooks.GetAllCategory().ToList(), "CatID", "CatName");
            return View();
        }
    }
}
